package uk.co.q3c.deplan.client.ui.mock.view;

import java.util.Stack;

import org.apache.log4j.Logger;

import uk.co.q3c.deplan.client.ui.view.Q3CoreView;
import uk.co.q3c.deplan.client.ui.view.ViewCreator;
import uk.co.q3c.deplan.client.ui.view.ViewCreatorGWT;
import uk.co.q3c.deplan.client.ui.view.Viewtags;

/**
 * @see ViewCreatorGWT
 * @see ViewCreator
 * @author David Sowerby 9 May 2010
 * 
 */
public class ViewCreatorMock implements ViewCreator {
	transient protected final Logger logger = Logger.getLogger(getClass().getName());
	public Stack<String> history = new Stack<String>();

	@Override
	public Q3CoreView createView(Viewtags index) {

		Q3CoreView view = null;
		switch (index) {
		case AbstractTaskView:
			view = new ProjectTaskViewMock();
			break;

		case ResourcesView:
			view = new ResourcesViewMock();
			break;
		case ProjectsView:
			view = new ProjectsViewMock();
			break;
		case HomeView:
			view = new HomeViewMock();
			break;
		case ProjectView:
			view = new ProjectViewMock();
			break;
		default:
			logger.error("class not defined for index: " + index.toString());
		}
		return view;
	}

	@Override
	public void newHistoryItem(String tokenAsString, boolean issueEvent) {
		history.push(tokenAsString);
	}
}
